1
|
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
package org.apache.geronimo.ews.ws4j2ee.context.impl;
|
18
|
|
|
19
|
|
import org.apache.axis.wsdl.symbolTable.BindingEntry;
|
20
|
|
import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
|
21
|
|
import org.apache.axis.wsdl.symbolTable.ServiceEntry;
|
22
|
|
import org.apache.geronimo.ews.jaxrpcmapping.J2eeEmitter;
|
23
|
|
import org.apache.geronimo.ews.jaxrpcmapping.JaxRpcMapper;
|
24
|
|
import org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext;
|
25
|
|
import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
|
26
|
|
import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
|
27
|
|
import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
|
28
|
|
|
29
|
|
import javax.wsdl.Operation;
|
30
|
|
import javax.wsdl.Part;
|
31
|
|
import javax.wsdl.Port;
|
32
|
|
import javax.xml.namespace.QName;
|
33
|
|
import java.io.InputStream;
|
34
|
|
import java.io.Writer;
|
35
|
|
import java.util.Iterator;
|
36
|
|
import java.util.Map;
|
37
|
|
|
38
|
|
|
39
|
|
|
40
|
|
|
41
|
|
|
42
|
|
|
43
|
|
|
44
|
|
|
45
|
|
public class JaxRpcMapperImpl implements JaxRpcMapperContext {
|
46
|
|
private JaxRpcMapper jaxrpcmapper;
|
47
|
|
private J2eeEmitter j2ee;
|
48
|
|
|
49
|
17
|
public JaxRpcMapperImpl(JaxRpcMapper jaxrpcmapper, J2eeEmitter j2ee) {
|
50
|
17
|
this.jaxrpcmapper = jaxrpcmapper;
|
51
|
17
|
this.j2ee = j2ee;
|
52
|
|
}
|
53
|
|
|
54
|
|
|
55
|
|
|
56
|
|
|
57
|
|
|
58
|
2
|
public String getExceptionType(QName messageQName) {
|
59
|
2
|
String exceptionName = jaxrpcmapper.getExceptionType(messageQName);
|
60
|
2
|
if (exceptionName == null) {
|
61
|
0
|
exceptionName = j2ee.getJavaName(messageQName);
|
62
|
0
|
if (exceptionName == null)
|
63
|
0
|
throw new UnrecoverableGenerationFault("the exception name in a SEI OP can not be null" +
|
64
|
|
"possibly be a bug check the WSDL2Java data extraction");
|
65
|
|
}
|
66
|
2
|
return exceptionName;
|
67
|
|
}
|
68
|
|
|
69
|
|
|
70
|
|
|
71
|
|
|
72
|
|
|
73
|
|
|
74
|
41
|
public String getJavaMethodName(BindingEntry bEntry, Operation operation) {
|
75
|
41
|
String opName = jaxrpcmapper.getJavaMethodName(bEntry, operation);
|
76
|
41
|
if (opName == null)
|
77
|
0
|
opName = operation.getName();
|
78
|
41
|
if (opName == null)
|
79
|
0
|
throw new UnrecoverableGenerationFault("the method name in a SEI OP can not be null" +
|
80
|
|
"possibly be a bug check the WSDL2Java data extraction");
|
81
|
41
|
return Utils.firstCharacterToLowerCase(opName);
|
82
|
|
}
|
83
|
|
|
84
|
|
|
85
|
|
|
86
|
|
|
87
|
|
|
88
|
|
|
89
|
|
|
90
|
55
|
public String getJavaMethodParamType(BindingEntry bEntry,
|
91
|
|
Operation operation,
|
92
|
|
int position, QName parmType) {
|
93
|
55
|
String type = jaxrpcmapper.getJavaMethodParamType(bEntry, operation, position);
|
94
|
55
|
if (type == null) {
|
95
|
54
|
type = j2ee.getJavaName(parmType);
|
96
|
54
|
if (type == null)
|
97
|
0
|
throw new UnrecoverableGenerationFault("the parm type name in a SEI OP can not be null" +
|
98
|
|
"possibly be a bug check the WSDL2Java data extraction");
|
99
|
|
}
|
100
|
55
|
return type;
|
101
|
|
}
|
102
|
|
|
103
|
|
|
104
|
|
|
105
|
|
|
106
|
|
|
107
|
|
|
108
|
41
|
public String getJavaMethodReturnType(BindingEntry bEntry,
|
109
|
|
Operation operation) {
|
110
|
41
|
String returnType = jaxrpcmapper.getJavaMethodReturnType(bEntry, operation);
|
111
|
41
|
if (returnType == null) {
|
112
|
5
|
Map parts = operation.getOutput().getMessage().getParts();
|
113
|
5
|
if (parts != null) {
|
114
|
5
|
Iterator returnlist = parts.values().iterator();
|
115
|
5
|
if (returnlist.hasNext()) {
|
116
|
0
|
Part part = (Part) returnlist.next();
|
117
|
0
|
returnType = jaxrpcmapper.getJavaType(part.getTypeName());
|
118
|
0
|
if (returnType == null)
|
119
|
0
|
returnType = j2ee.getJavaName(part.getTypeName());
|
120
|
|
}
|
121
|
|
}
|
122
|
|
}
|
123
|
41
|
return returnType;
|
124
|
|
|
125
|
|
|
126
|
|
}
|
127
|
|
|
128
|
|
|
129
|
|
|
130
|
|
|
131
|
|
|
132
|
2
|
public String getJavaType(QName typeQName) {
|
133
|
2
|
String type = jaxrpcmapper.getJavaType(typeQName);
|
134
|
2
|
if (type == null)
|
135
|
0
|
type = j2ee.getJavaName(typeQName);
|
136
|
2
|
if (type == null)
|
137
|
0
|
throw new UnrecoverableGenerationFault("the type name can" +
|
138
|
|
" not be null possibly be a bug check the WSDL2Java data extraction");
|
139
|
2
|
return type;
|
140
|
|
}
|
141
|
|
|
142
|
|
|
143
|
|
|
144
|
|
|
145
|
|
|
146
|
0
|
public String getPortName(Port port) {
|
147
|
0
|
String portName = jaxrpcmapper.getPortName(port);
|
148
|
0
|
if (portName == null) {
|
149
|
0
|
portName = port.getName();
|
150
|
0
|
if (portName == null)
|
151
|
0
|
throw new UnrecoverableGenerationFault("the portName can" +
|
152
|
|
" not be null, possibly be a bug check the WSDL2Java data extraction");
|
153
|
|
}
|
154
|
0
|
return portName;
|
155
|
|
}
|
156
|
|
|
157
|
|
|
158
|
|
|
159
|
|
|
160
|
|
|
161
|
|
|
162
|
12
|
public String getServiceEndpointInterfaceName(PortTypeEntry ptEntry,
|
163
|
|
BindingEntry bEntry) {
|
164
|
12
|
String seiName = jaxrpcmapper.getServiceEndpointInterfaceName(ptEntry, bEntry);
|
165
|
12
|
if (seiName == null) {
|
166
|
0
|
seiName = ptEntry.getName();
|
167
|
0
|
if (seiName == null)
|
168
|
0
|
throw new UnrecoverableGenerationFault("the seiName can" +
|
169
|
|
" not be null, possibly be a bug check the WSDL2Java data extraction");
|
170
|
|
}
|
171
|
12
|
return seiName;
|
172
|
|
}
|
173
|
|
|
174
|
|
|
175
|
|
|
176
|
|
|
177
|
|
|
178
|
1
|
public String getServiceInterfaceName(ServiceEntry entry) {
|
179
|
1
|
String serviceInterface = jaxrpcmapper.getServiceInterfaceName(entry);
|
180
|
1
|
if (serviceInterface == null) {
|
181
|
0
|
serviceInterface = entry.getName();
|
182
|
0
|
if (serviceInterface == null)
|
183
|
0
|
throw new UnrecoverableGenerationFault("the serviceInterface can" +
|
184
|
|
" not be null, possibly be a bug check the WSDL2Java data extraction");
|
185
|
|
}
|
186
|
1
|
return serviceInterface;
|
187
|
|
}
|
188
|
|
|
189
|
|
|
190
|
|
|
191
|
|
|
192
|
0
|
public void loadMappingFromDir(String path) throws GenerationFault {
|
193
|
0
|
jaxrpcmapper.loadMappingFromDir(path);
|
194
|
|
}
|
195
|
|
|
196
|
|
|
197
|
|
|
198
|
|
|
199
|
0
|
public void loadMappingFromInputStream(InputStream is) throws GenerationFault {
|
200
|
0
|
jaxrpcmapper.loadMappingFromInputStream(is);
|
201
|
|
}
|
202
|
|
|
203
|
|
|
204
|
|
|
205
|
|
|
206
|
0
|
public void serialize(Writer out) {
|
207
|
0
|
throw new UnsupportedOperationException("when the wsdl is avalibe serialization not reqired");
|
208
|
|
}
|
209
|
|
|
210
|
|
|
211
|
|
|
212
|
|
|
213
|
0
|
public String getPackageMappingClassName(int index) {
|
214
|
0
|
return jaxrpcmapper.getPackageMappingClassName(index);
|
215
|
|
}
|
216
|
|
|
217
|
0
|
public int getPackageMappingCount() {
|
218
|
0
|
return jaxrpcmapper.getPackageMappingCount();
|
219
|
|
}
|
220
|
|
|
221
|
0
|
public String getPackageMappingURI(int index) {
|
222
|
0
|
return jaxrpcmapper.getPackageMappingURI(index);
|
223
|
|
}
|
224
|
|
|
225
|
|
}
|
226
|
|
|